
<jsp:directive.page import="java.sql.*"/>
<jsp:directive.page import="Connectivity.ConnectionManager"/>
 <%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String Activity = request.getParameter("Activity")!=null?request.getParameter("Activity"):"2";
%>
   <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
   "http://www.w3.org/TR/html4/loose.dtd">

   <html>

      <head>
         <meta http-equiv="Content-Type" 
            content="text/html; charset=windows-1256">
         <title>   Group Creation  </title>
      </head>
 <SCRIPT language=JavaScript>
	var reset = 0;
	var lastKeyCode = 0;
	var lastKeyCode1 = 0;
    var lastKeyCode2 = 0;


function mySubmit()
{
  var flag=0;			

		  if(document.groupcreation.groupcode.value==0){
					flag=1;
					alert('plz Enter the groupcode');
					document.groupcreation.groupcode.focus();
					return false;
			}
			if(document.groupcreation.groupname.value==0){
					flag=1;
					alert('plz Enter the name');
					document.groupcreation.groupname.focus();
					return false;
			}
			 if(flag==0)
			{document.groupcreation.action = "/Genius/MasterServlet";
			document.groupcreation.submit();
		    return true;
		     }
			  
		}		

	function callFun(groupcode, groupname){
		//document.getElementById("del").style.display = 'block';
		document.groupcreation.create.value = "Update";
		document.groupcreation.groupcode.value = groupcode;
		document.groupcreation.groupname.value = groupname;
		//document.groupcreation.reservation.value = res;
		reset=1;
	}

	function  onChange(){
		document.groupcreation.create.value= "create";
		if(reset==1){
		document.getElementById("del").style.display = 'none';
		}
	}
	function  callDelete(){
		var flag = 0 ;
		if(isNumeric(document.groupcreation.groupname.value) || isNull(document.groupcreation.groupname.value) || isBlank(document.groupcreation.groupname.value)){
			flag=1;
			alert('plz select the group');
			document.groupcreation.groupname.focus();
			return false;
		}
		
		if(flag==0){		
		if(confirm('You Really want to delete?')){
			document.groupcreation.action = "GroupCreation.jsp";
		  	document.groupcreation.submit();
			}else{
				return false;
			}
			
		}
	}

	function setFocusOnLoad(){
		window.document.groupcreation.elements[0].focus();
	}
	
	function startsWithDigit(val)	{
		var counter		= 0;
		var	singleChar	= "";
		var	validChars	= "0123456789";
	
		if(isBlank(val))
			return false;
	
		val = val.substr(0, 1);
	
		if(validChars.indexOf(val) != -1){
			return false;
		}
		return true;
	}
	

	
	/*function  stopSpecialChar(){
		if((window.event.keyCode >= 33  && window.event.keyCode <= 44) || (window.event.keyCode >= 47  && window.event.keyCode <= 48) || (window.event.keyCode >= 57  && window.event.keyCode <= 64) || window.event.keyCode == 96 || (window.event.keyCode >= 91  && window.event.keyCode <= 94) || (window.event.keyCode >= 123  && window.event.keyCode <= 126)){
		window.event.keyCode = 0;
		}
	}*/
	
  </SCRIPT>
      
<body>
<table border=1 width=100% height=100%>
<tr><td>
<table align=right height=20% width=100% >
			<tr>
			  <td align=right><%=(session.getAttribute("firm_name"))%></td>
			 <td align=right><img src="<%=basePath%>images\Company.jpg" height=119 width=109></td> 
			 </tr>
			</table>

 </tr></td>
 <tr><td><marquee>welcome <%=(session.getAttribute("uname")) %></marquee>

 </td></tr>
 
 <tr><td>
 <table width=100% height=80%>
 <tr >
 <table id=Employee align=left border=1  width=20% cellspacing="20" cellpadding="8">
 <%
 int role_id=Integer.parseInt(""+(session.getAttribute("role_id")));
 String mainimage=null,maindesc=null;
 Connection con=null;
 PreparedStatement prst=null,prst1=null;
		String firm_id=null,firm_name=null,firm_city=null,firm_image=null;
	try
	{	
		con=ConnectionManager.getConnection();
  
	String querry="select mlm.main_link_id,mlm.main_link_desc,mlm.main_link_information,trim(mlm.main_link_image_location)as image_path ";
	 querry=querry+"from access_control_list acl JOIN main_link_master mlm ON (acl.main_link_id=mlm.main_link_id and  mlm.status='V' and acl.role_id="+role_id+") ";
     querry=querry+"group by mlm.main_link_desc,mlm.main_link_information,trim(mlm.main_link_image_location),mlm.main_link_id,mlm.order_id ";
     querry=querry+"order by mlm.order_id ";
	 prst=con.prepareStatement(""+querry);
	    ResultSet rs=prst.executeQuery();
	    if(rs.equals(null))
	  {
 
out.println(" Error");
 		
 	   }
 	   else
 	   { int cnt=1;
 	   while(rs.next())
 	   {
if(Activity.equals(rs.getString(1)))
{
mainimage=rs.getString(4);
maindesc=rs.getString(3);

}
  %>
  
<tr><td align="center">
<a href='/Genius/form/general/userLogged.jsp?Activity=<%=rs.getString(1)%>'><%=rs.getString(2)%></a></td></tr>
<%}

} %>

</tr>
<tr><td align="center">
<a href='/Genius/form/general/Login.jsp'>Logout</a></td></tr>

<td>
<tr>
<form name=groupcreation method=get >
    <table align=center border=1 width=50%>
    <tr><td align=center width=100%><font size=4> Group Creation </font> </td></tr>
    <tr><td align=center >GROUP CODE:&nbsp;&nbsp;&nbsp;<input id=groupid type=text name=groupcode value=""> </td></tr>
    <tr><td align=center >GROUP NAME:&nbsp;&nbsp;&nbsp;<input type=text name=groupname value=""> </td></tr>
    <tr><td align=center ><input type=submit name=submit value="Create" onclick=mySubmit()>&nbsp;&nbsp;&nbsp;&nbsp;<input type=reset name=reset value="Reset"> </td></tr>
<%

String groupquerry="select group_code,group_name from item_group_master where status='V'";
  prst1=con.prepareStatement(""+groupquerry);
  ResultSet rs1=prst1.executeQuery();
  while(rs1.next())
  {

 %>

    <tr>
    <td align=center>
    <a href="javascript:callfun('<%=rs1.getString(1)%>','<%=rs1.getString(2) %>')"><%=rs1.getString(2)%></a> </td></tr>

<%

}





 %>




    </table>     
   </form>    
       
       
       
       
          
      

 
</tr>
</tr></td>   
<%
}
catch(Exception e)
{e.printStackTrace();}

 %></td></tr></table>

      </body>
	
   </html>